<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>添加公告</title>

    <style>
        /* 右侧内容区域 */
        .index-content {
            position: relative;
            margin-left: 222px;
            margin-top: -783px;
            padding: 20px;
            min-height: 86vh;
            z-index: 1;
        }

        .index-content::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: url("img/rightbg.jpg");
            background-size: cover;
            opacity: 0.3;
            z-index: -1;
        }

        .index-content-operation {
            margin-bottom: 20px;
        }
        .index-content-operation .info-detail {
            font-size: 26px;
            font-weight: bold;
            font-family: youyuan;
            color: #333;
        }

        /* 表单容器 */
        form {
            width: 50%;
            padding: 20px 0 20px 20px;
            margin: 0 30px;
            border: 1px solid rgba(87, 41, 20, 0.65);
            border-radius: 8px;
            background-color: #fdf6e4;
        }

        /* 表格样式 */
        .index-content-table-add {
            width: 100%;
            border-collapse: collapse;
        }

        /* 表格单元格样式 */
        .index-content-table-add td {
            padding: 12px 15px;
            font-size: 16px;
            vertical-align: middle;
        }

        /* 输入框样式 */
        .index-content-table-td-add, textarea{
            width: 500px;
            padding: 8px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
            transition: border-color 0.3s;
            margin-left: -15px;
        }

        /* 输入框获得焦点时的样式 */
        .index-content-table-td-add:focus, textarea:focus {
            border-color: #333333;
            outline: none;
        }

        /* 单选框样式 */
        input[type="radio"] {
            margin: 0 10px 0 0;
        }

        /* 提交和取消按钮样式 */
        button {
            padding: 8px 15px;
            font-weight: bold;
            border-radius: 4px;
            cursor: pointer;
            border: none;
            transition: background-color 0.3s, border-color 0.3s;
            margin-left: 100px;
            margin-top: -50px;
        }

        /* 提交按钮样式 */
        .btn-success {
            background-color: #de9050;
            color: white;
        }

        .btn-success:hover {
            background-color: #de7850;
        }

        /* 取消按钮样式 */
        .btn-primary {
            background-color: #504d4d;
            color: white;
        }

        .btn-primary:hover {
            background-color: #333333;
        }

        /* 按钮的小尺寸 */
        .btn-sm {
            font-size: 12px;
            padding: 5px 12px;
        }

        /* 表单行的标签样式 */
        .index-content-table-add td:first-child {
            font-weight: bold;
        }

        /* 表格内容的居中样式 */
        .index-content-table-add td {
            text-align: left;
        }
    </style>

</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail"> >> 公告管理 >> 添加公告</a>
    </div>
    <br>
    <form action="NoticeServlet?action=add" method="post" onsubmit="return check()">
        <table class="index-content-table-add">
            <tr>
                <td width="12%">标题：</td><td><input class="index-content-table-td-add" type="text" id="noticeName" name="noticeName" value=""/></td>
            </tr>
            <tr>
                <td width="12%">类型：</td><td><input class="index-content-table-td-add" type="text" id="noticeType" name="noticeType" value=""/></td>
            </tr>
            <tr>
                <td width="12%">内容：</td><td><textarea id="noticeText" name="noticeText" style="width: 60%; height: 100px;padding: 0px 10px;" placeholder="请输入内容......"></textarea></td>
            </tr>
            <tr>
                <td width="12%">创建时间：</td><td><input class="index-content-table-td-add" type="text" id="createDate" name="createDate" value=""/></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-line btn-primary btn-sm" onclick="javascript:history.back(-1);" style=";font-size: 18px;width: 120px">取 消</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="submit" class="btn btn-line btn-success btn-sm" style="width: 120px;font-size: 18px;">提 交</button>

    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("noticeName").value.trim().length == 0) {
            alert("标题不能为空!");
            return false;
        }
        if (document.getElementById("noticeType").value.trim().length == 0) {
            alert("类型不能为空!");
            return false;
        }
        if (document.getElementById("createDate").value.trim().length == 0) {
            alert("创建时间不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>
